//
//  tempOneTableViewCell.m
//  XWZ_News_Work
//
//  Created by dllo on 16/1/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "tempOneTableViewCell.h"

@interface tempOneTableViewCell()

@property (nonatomic, strong) UIView *backV;
@property (nonatomic, strong) UILabel *backLab;

@end

@implementation tempOneTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.backV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(@5);
        make.top.equalTo(@5);
        make.right.equalTo(self.contentView).offset(-5);
        make.bottom.equalTo(self.contentView).offset(-5);
        
    }];
    
    [self.imageLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@10);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.6);
        make.height.equalTo(self.contentView.mas_width).multipliedBy(0.6);

    }];
    [self.imageRightTop mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imageLeft.mas_right).offset(3);
        make.top.equalTo(@10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(self.imageLeft).multipliedBy(0.5).offset(0.5);

    }];
    [self.imageRightBelow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imageLeft.mas_right).offset(3);
        make.top.equalTo(self.imageRightTop.mas_bottom).offset(1);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(self.imageLeft).multipliedBy(0.5).offset(0.5);
    }];
    
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageLeft.mas_bottom).offset(-7);
        make.left.equalTo(@10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(self.imageLeft).multipliedBy(0.3);
    }];
    
    [self.backLab mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(@10);
        make.top.equalTo(self.sourceLab.mas_top).offset(1);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@1);
        
    }];
    
    [self.sourceLab mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.titleLab.mas_bottom).offset(-1);
        make.left.equalTo(@10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@20);
        
    }];
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor colorWithRed:191 / 255.0 green:191 / 255.0 blue:191 / 255.0 alpha:1.0];
    self.backV = [UIView new];
    self.backV.backgroundColor = [UIColor whiteColor];
    self.backV.layer.cornerRadius = 10;
    self.backV.layer.masksToBounds = YES;
    [self.contentView addSubview:self.backV];
    
    self.imageLeft = [UIImageView new];
    [self.contentView addSubview:self.imageLeft];
    
    self.imageRightTop = [UIImageView new];
    [self.contentView addSubview:self.imageRightTop];
    
    self.imageRightBelow = [UIImageView new];
    [self.contentView addSubview:self.imageRightBelow];
    
    self.titleLab = [UILabel new];
    self.titleLab.numberOfLines = 0;
    self.titleLab.font = [UIFont systemFontOfSize:18];
    [self.contentView addSubview:self.titleLab];
    
    self.backLab = [UILabel new];
    self.backLab.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.backLab];
    
    self.sourceLab = [UILabel new];
    self.sourceLab.textColor = [UIColor grayColor];
    self.sourceLab.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.sourceLab];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
